﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.Model;
using System.Collections.ObjectModel;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for SearchAdvancedProductTest and is intended
    ///to contain all SearchAdvancedProductTest Unit Tests
    ///</summary>
    [TestClass()]
    public class SearchAdvancedProductTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for FilteringFields
        ///</summary>
        [TestMethod()]
        public void FilteringFieldsTestSuccess()
        {
            string category = "Electronics"; // TODO: Initialize to an appropriate value
            string price1 = "100"; // TODO: Initialize to an appropriate value
            string price2 = "200"; // TODO: Initialize to an appropriate value
            string priceCurrency = "Dollars"; // TODO: Initialize to an appropriate value
            string quantity1 = "1"; // TODO: Initialize to an appropriate value
            string quantity2 = "2"; // TODO: Initialize to an appropriate value
            string date1 = DateTime.Now.ToString(); // TODO: Initialize to an appropriate value
            DateTime aux=DateTime.Now.AddMonths(2);
            string date2 = aux.ToString(); // TODO: Initialize to an appropriate value
            string text = ""; // TODO: Initialize to an appropriate value
            SearchAdvancedProduct.FilteringFields(category, price1, price2, priceCurrency, quantity1, quantity2, date1, date2, text);
           
        }

         [TestMethod()]
        [ExpectedException(typeof(ValidationException))]
        public void FilteringFieldsTestInvalidPrice()
        {
            string category = "Electronics"; // TODO: Initialize to an appropriate value
            string price1 = "200"; // TODO: Initialize to an appropriate value
            string price2 = "100"; // TODO: Initialize to an appropriate value
            string priceCurrency = "Dollars"; // TODO: Initialize to an appropriate value
            string quantity1 = "1"; // TODO: Initialize to an appropriate value
            string quantity2 = "2"; // TODO: Initialize to an appropriate value
            string date1 = DateTime.Now.ToString(); // TODO: Initialize to an appropriate value
            DateTime aux = DateTime.Now.AddMonths(2);
            string date2 = aux.ToString(); // TODO: Initialize to an appropriate value
            string text = ""; // TODO: Initialize to an appropriate value
            SearchAdvancedProduct.FilteringFields(category, price1, price2, priceCurrency, quantity1, quantity2, date1, date2, text);
           
        }

         [TestMethod()]
         [ExpectedException(typeof(ValidationException))]
         public void FilteringFieldsTestInvalidPriceCurrency()
         {
             string category = "Electronics"; // TODO: Initialize to an appropriate value
             string price1 = "200"; // TODO: Initialize to an appropriate value
             string price2 = "300"; // TODO: Initialize to an appropriate value
             string priceCurrency = ""; // TODO: Initialize to an appropriate value
             string quantity1 = "1"; // TODO: Initialize to an appropriate value
             string quantity2 = "2"; // TODO: Initialize to an appropriate value
             string date1 = DateTime.Now.ToString(); // TODO: Initialize to an appropriate value
             DateTime aux = DateTime.Now.AddMonths(2);
             string date2 = aux.ToString(); // TODO: Initialize to an appropriate value
             string text = ""; // TODO: Initialize to an appropriate value
             SearchAdvancedProduct.FilteringFields(category, price1, price2, priceCurrency, quantity1, quantity2, date1, date2, text);

         }

         [TestMethod()]
         [ExpectedException(typeof(ValidationException))]
         public void FilteringFieldsTestInvalidQuantity()
         {
             string category = "Electronics"; // TODO: Initialize to an appropriate value
             string price1 = "200"; // TODO: Initialize to an appropriate value
             string price2 = "300"; // TODO: Initialize to an appropriate value
             string priceCurrency = "Dollars"; // TODO: Initialize to an appropriate value
             string quantity1 = "2"; // TODO: Initialize to an appropriate value
             string quantity2 = "1"; // TODO: Initialize to an appropriate value
             string date1 = DateTime.Now.ToString(); // TODO: Initialize to an appropriate value
             DateTime aux = DateTime.Now.AddMonths(2);
             string date2 = aux.ToString(); // TODO: Initialize to an appropriate value
             string text = ""; // TODO: Initialize to an appropriate value
             SearchAdvancedProduct.FilteringFields(category, price1, price2, priceCurrency, quantity1, quantity2, date1, date2, text);

         }

         [TestMethod()]
         [ExpectedException(typeof(ValidationException))]
         public void FilteringFieldsTestInvalidDate()
         {
             string category = "Electronics"; // TODO: Initialize to an appropriate value
             string price1 = "200"; // TODO: Initialize to an appropriate value
             string price2 = "300"; // TODO: Initialize to an appropriate value
             string priceCurrency = "Dollars"; // TODO: Initialize to an appropriate value
             string quantity1 = "1"; // TODO: Initialize to an appropriate value
             string quantity2 = "2"; // TODO: Initialize to an appropriate value
             string date2 = DateTime.Now.ToString(); // TODO: Initialize to an appropriate value
             DateTime aux = DateTime.Now.AddMonths(2);
             string date1 = aux.ToString(); // TODO: Initialize to an appropriate value
             string text = ""; // TODO: Initialize to an appropriate value
             SearchAdvancedProduct.FilteringFields(category, price1, price2, priceCurrency, quantity1, quantity2, date1, date2, text);

         }

         [TestMethod()]
         [ExpectedException(typeof(ValidationException))]
         public void FilteringFieldsTestPriceError()
         {
             string category = "Electronics"; // TODO: Initialize to an appropriate value
             string price1 = ""; // TODO: Initialize to an appropriate value
             string price2 = "100"; // TODO: Initialize to an appropriate value
             string priceCurrency = ""; // TODO: Initialize to an appropriate value
             string quantity1 = "1"; // TODO: Initialize to an appropriate value
             string quantity2 = "2"; // TODO: Initialize to an appropriate value
             string date1 = DateTime.Now.ToString(); // TODO: Initialize to an appropriate value
             DateTime aux = DateTime.Now.AddMonths(2);
             string date2 = aux.ToString(); // TODO: Initialize to an appropriate value
             string text = ""; // TODO: Initialize to an appropriate value
             SearchAdvancedProduct.FilteringFields(category, price1, price2, priceCurrency, quantity1, quantity2, date1, date2, text);

         }

         [TestMethod()]
         [ExpectedException(typeof(ValidationException))]
         public void FilteringFieldsTestQuantityError()
         {
             string category = "Electronics"; // TODO: Initialize to an appropriate value
             string price1 = "100"; // TODO: Initialize to an appropriate value
             string price2 = "200"; // TODO: Initialize to an appropriate value
             string priceCurrency = "Dollars"; // TODO: Initialize to an appropriate value
             string quantity1 = ""; // TODO: Initialize to an appropriate value
             string quantity2 = "2"; // TODO: Initialize to an appropriate value
             string date1 = DateTime.Now.ToString(); // TODO: Initialize to an appropriate value
             DateTime aux = DateTime.Now.AddMonths(2);
             string date2 = aux.ToString(); // TODO: Initialize to an appropriate value
             string text = ""; // TODO: Initialize to an appropriate value
             SearchAdvancedProduct.FilteringFields(category, price1, price2, priceCurrency, quantity1, quantity2, date1, date2, text);

         }

         [TestMethod()]
         [ExpectedException(typeof(ValidationException))]
         public void FilteringFieldsTestPriceFormatError()
         {
             string category = "Electronics"; // TODO: Initialize to an appropriate value
             string price1 = "ajksdajd"; // TODO: Initialize to an appropriate value
             string price2 = "asmdnamsd"; // TODO: Initialize to an appropriate value
             string priceCurrency = "Dollars"; // TODO: Initialize to an appropriate value
             string quantity1 = "1"; // TODO: Initialize to an appropriate value
             string quantity2 = "2"; // TODO: Initialize to an appropriate value
             string date1 = DateTime.Now.ToString(); // TODO: Initialize to an appropriate value
             DateTime aux = DateTime.Now.AddMonths(2);
             string date2 = aux.ToString(); // TODO: Initialize to an appropriate value
             string text = ""; // TODO: Initialize to an appropriate value
             SearchAdvancedProduct.FilteringFields(category, price1, price2, priceCurrency, quantity1, quantity2, date1, date2, text);

         }

         [TestMethod()]
         [ExpectedException(typeof(ValidationException))]
         public void FilteringFieldsTestInvalidFormatQuantity()
         {
             string category = "Electronics"; // TODO: Initialize to an appropriate value
             string price1 = "200"; // TODO: Initialize to an appropriate value
             string price2 = "300"; // TODO: Initialize to an appropriate value
             string priceCurrency = "Dollars"; // TODO: Initialize to an appropriate value
             string quantity1 = "aksnds"; // TODO: Initialize to an appropriate value
             string quantity2 = "asnandas"; // TODO: Initialize to an appropriate value
             string date1 = DateTime.Now.ToString(); // TODO: Initialize to an appropriate value
             DateTime aux = DateTime.Now.AddMonths(2);
             string date2 = aux.ToString(); // TODO: Initialize to an appropriate value
             string text = ""; // TODO: Initialize to an appropriate value
             SearchAdvancedProduct.FilteringFields(category, price1, price2, priceCurrency, quantity1, quantity2, date1, date2, text);

         }


    }
}
